﻿@using CoffeeTeaTrading.Repository.Context
@{
    ViewBag.Title = "Index";
}
<script src="../../Scripts/jquery.numericupdown.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $(".spin1").NumericUpDown();
    });
		</script>
    <style type="text/css">
			/*----- NumericUpDownControl's Style -----*/
			.numericupdown{}
			.val
			{
			  height: 18px;
			  margin:0px;
			  padding-top:0px;
			  padding-bottom:0px;
			  float:left;
			}
			.up
			{
			  border: 0px none white;
			  width:15px;
			  height:10px;
			  overflow:hidden;
			}
			.down
			{
			  border: 0px none white;
			  width:15px;
			  height:10px;
			  overflow:hidden;
			}
			/*----------------------------------------*/
		</style>
@{
    var list = new List<Product>();
    Random r = new Random();
    for (int i = 0; i < 10; i++ )
    {
        var p = new Product() {ID = i, Cost = r.Next(10000)};
        list.Add(p);
    }
}

    @foreach (var product in list)
    {
        using (Ajax.BeginForm("AddToCart", "Cart", new AjaxOptions() { HttpMethod = "Post" }))
        {
            @Html.Hidden("ProductId", product.ID);
            <span>@product.ID</span>                                     
            <span>@product.Cost</span> 
            <input type="text" class="spin1" value="0" style="width:60px;"/>
            <input type="submit" value="Add to cart"/>
            <div style="float:none; clear:both;" ></div>
            <br />
        }
    }